<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="format-detection" content="telephone=no">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
    <link href="../../../css/bootstrap.css" rel="stylesheet" />
    <link href="../../../css/cover.css" rel="stylesheet" />
    <link href="../../../css/font-awesome.min.css" rel="stylesheet" />
    <title>荆州千网汇信息科技有限公司</title>
    <script src="../../../js/jquery-2.2.3.min.js"></script>
    <script src="../../../js/jquery.flexslider-min.js"></script>
    <script src="../../../js/rem.js"></script>
    <script src="../../../js/itnetcao.js"></script>
    
    <link href="../../../js/layui/css/layui.css" rel="stylesheet" />
    
    <link href="../../../js/donghua/animsition.min.css" rel="stylesheet" />
    <script src="../../../js/donghua/animsition.min.js"></script>
    <link rel="stylesheet" href="../../../css/minirefresh.css" />
    <link rel="stylesheet" href="../../../css/common.css" />
    <script type="text/javascript" src="../../../js/minirefresh.js"></script>
    <script type="text/javascript" src="../../../js/common.js"></script>
    
    
	
</head>

	<body style='width:100%;'>
		
        <div class="page_top01 relative">
            <h3 class="text-center">修改交易密码</h3>
            <a href="javascript:;" class="animsition-link" data-animsition-out-class="fade-out-right" data-animsition-out-duration="500" onclick="history.go(-1)">
                <img src="../../../images/icon_left.png" class="img-responsive reture_img" /></a>

        </div>
		
		
		
		<div class="layui-fluid" style='margin-top:10%;'>
			
			<div class="layui-row layui-col-space15">
				<div class="layui-col-xs12">
					<input type="password" class="text-oldpwd newJiaoyiMiMa layui-input" placeholder="请输入新交易密码"/>
				</div>
			</div>
			
			<div class="layui-row layui-col-space15">
				<div class="layui-col-xs12">
					<input type="password" class="text-oldpwd twoNewJiaoyiMiMa layui-input" placeholder="请重复输入新密码"/>
				</div>
			</div>
			
			<div class="layui-row layui-col-space15">
				<div class="layui-col-xs6">
					<input class="text-imgyzm sendIphone layui-input" type="text" placeholder="手机号码"/>
				</div>
				<div class="layui-col-xs6">
					<button class="dxyzm sendIphoneCode layui-btn layui-btn-normal">发送验证码</button>
				</div>
			</div>
			
			<div class="layui-row layui-col-space15">
				<div class="layui-col-xs12">
					<input class="text-dxyzm iphoneCodes layui-input" type="text" placeholder="请输入验证码"/>
				</div>
			</div>
			
			<div class="layui-row layui-col-space15" style='margin-top:10%;'>
				<div class="layui-col-xs12">
					<button id="btnOK" class="layui-btn layui-btn-warm" style='width:100%;'>确定</button>
				</div>
			</div>
		
		<script type='text/javascript'>
		var code = "";
		var a_count = 120;
		$(function() {
			
			$("#btnOK").click(function() {
				if($(".sendIphone").val().trim().length == 0) {
					alert("请输入手机号码.");
					return;
				}
				if($(".sendIphone").val().trim().length != 11) {
					alert("手机号码不正确.");
					return;
				}
				if($(".newJiaoyiMiMa").val().trim().length == 0) {
					alert("请输入交易密码.");
					return;
				}
				if($(".newJiaoyiMiMa").val().trim().length < 5) {
					alert("新的交易密码必须5位数以上.");
					return;
				}
				if($(".newJiaoyiMiMa").val().trim() != $(".twoNewJiaoyiMiMa").val().trim()) {
					alert("两次输入的交易密码不一致.");
					return;
				}
				if(code != $(".iphoneCodes").val().trim()) {
					alert("请输入验证码或验证码不正确.");
					return;
				}
				var url = localStorage.getItem("url") + "/user/controller/UpdateuserTransactionPasswordAPP.do";
				var data = "userId=" + jQuery.parseJSON(localStorage.getItem("miningmachine_user")).userId + 
				           "&newTransactionPas=" + $(".newJiaoyiMiMa").val().trim() + "&towNewTransactionPas=" + $(".twoNewJiaoyiMiMa").val().trim();
				itcao.itGetAjaxBigData(url, data).done(function(result) {
					var json = jQuery.parseJSON(result);
					if(json.state == true) {
						alert("修改成功.");
						window.location.href = "../userMineMain.html";
					}else {
						alert(json.value);
						return;
					}
					
				})
			})
			
			
			$(".sendIphoneCode").click(function() {
				if($(".sendIphoneCode").text() != "发送验证码") {
					return;
				}
				var url = localStorage.getItem("url") + "/user/controller/getUserIPhoneCodeAPP.do";
				var data = "iphone=" + $(".sendIphone").val();
				if($(".sendIphone").val().trim().length == 0) {
					alert("请输入手机号码.");
					return;
				}
				if($(".sendIphone").val().trim().length != 11) {
					alert("手机号码不正确.");
					return;
				}
				var n = setInterval(function() {
  					a_count--;
  					if(a_count <= 0) {
  						$(".sendIphoneCode").text("发送验证码")
  						window.clearInterval(n);
  						return;
  					}
  					$(".sendIphoneCode").text(a_count + "重新获取.")
  				}, 1000)
				
				itcao.itGetAjaxBigData(url, data).done(function(result) {
  					var json = jQuery.parseJSON(result);
  					if(json.state == true) {
  						code = json.bean;
  					}else {
  						alert(json.value);
  					}
  				})
			})
		})
		</script>
	</body>
</html>
